﻿<UserControl x:Class="MessengerSample.ConversationWindow"
    xmlns="http://schemas.microsoft.com/client/2007" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:Messenger="clr-namespace:Microsoft.Live.Messenger;assembly=Microsoft.Live.Messenger"
    xmlns:MessengerUx="clr-namespace:MessengerSample"
    Width="400" Height="600"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" HorizontalAlignment="Right">
    
    <UserControl.Resources>
        <MessengerUx:ConversationToConversationNameConverter x:Key="ToName" />
        <MessengerUx:PresenceToFriendlyNameConverter x:Key="PresenceToFriendlyName2" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">

        <Grid.Background>
            <LinearGradientBrush EndPoint="0.254000008106232,0.990000009536743" StartPoint="0.254,0.01">
                <GradientStop Color="#FF1F568A" Offset="1"/>
                <GradientStop Color="#FF709EFA" Offset="0"/>
            </LinearGradientBrush>
        </Grid.Background>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="98"/>
        </Grid.ColumnDefinitions>

        <Grid.RowDefinitions>
            <RowDefinition Height="86"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="73.5"/>
        </Grid.RowDefinitions>

        <Border Grid.Row="2" Margin="8,8,8,8"  CornerRadius="5,5,5,5" Background="#72FFFFFF" BorderBrush="#FF000000" HorizontalAlignment="Stretch">
            <TextBox x:Name="MessageTextBox" Background="#00FFFFFF" BorderBrush="#00000000" Foreground="#FF000000" FontFamily="Trebuchet MS" />
        </Border>

        <Button Grid.Row="2" Grid.Column="1" HorizontalAlignment="Stretch" Margin="8,8,8,8" VerticalAlignment="Stretch" Click="SendButton_Click"  Content="Send" FontFamily="Trebuchet MS" FontSize="16" Style="{StaticResource SendButton}" />

        <Border Grid.Column="0" CornerRadius="5,5,5,5" HorizontalAlignment="Stretch"  Background="#72FFFFFF" BorderBrush="#FF000000" Margin="8,8,8,8" VerticalAlignment="Center" >
            <TextBlock HorizontalAlignment="Stretch" TextWrapping="Wrap" Text="{Binding Roster, Converter={StaticResource ToName}}" FontFamily="Comic Sans MS" FontSize="48" Margin="5,0,0,0"/>
		</Border>

        <Border Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Stretch" Margin="8,8,8,8" VerticalAlignment="Stretch"  Background="#FF03588D" CornerRadius="5,5,5,5">

            <ListBox Style="{StaticResource MessageHistory}" ItemsSource="{Binding History, Mode=OneWay}">

                <ListBox.ItemTemplate>
                    <DataTemplate>

                        <StackPanel Orientation="Horizontal" Margin="5">
                            <TextBlock FontFamily="Comic Sans MS" FontSize="16" Foreground="red" Text="{Binding Sender.Presence, Converter={StaticResource PresenceToFriendlyName2}}"/>
							<TextBlock Text=":  "/>
							<TextBlock FontFamily="Comic Sans MS" FontSize="16" Text="{Binding Text}"/>
						</StackPanel>

                    </DataTemplate>
                </ListBox.ItemTemplate>

            </ListBox>

        </Border>

    </Grid>
</UserControl>
